<?php
/**
 * Description of TipoLeilaoService
 *
 * @author Magno
 */
class TipoLeilaoService {

    private $tipoLeilaoDAO;
    public function __construct() {
        $this->tipoLeilaoDAO = new TipoLeilaoDAO();
    }

    public function salvar($tipoLeilao) {
        try {
            return $this->tipoLeilaoDAO->salvar($tipoLeilao);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }

    public function excluir($tipoLeilaoID) {

        try {
            if(!isset ($tipoLeilaoID) || $tipoLeilaoID <= 0)
                throw new Exception("Codigo do TipoLeilao Nao Econtrado!!!");

            $this->tipoLeilaoDAO->excluir($tipoLeilaoID);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }

    public function listar($pagina = 0,$descricao = "") {
        try {
            return $this->tipoLeilaoDAO->listar($pagina, $descricao);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }

    public function buscarPorID($tipoLeilaoID) {
        try {
            if(!isset ($tipoLeilaoID) || $tipoLeilaoID <= 0)
                throw new Exception("Codigo do TipoLeilao Nao Econtrado!!!");
            $this->tipoLeilaoDAO->buscarPorID($tipoLeilaoID);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }

    public function total($descricao = "") {
        try {
            return $this->tipoLeilaoDAO->total($descricao);
        }catch(Exception $err) {
            throw new Exception($err->getMessage());
        }
    }
}
?>
